#include<iostream>
#include<string>
#include<vector>
#include<algorithm>
using namespace std;
const int N = 110;
vector<string> a(N);
int main()
{
    int i = 0;
    string s;
    getline(cin, s);
    int pos = 0;
    string tmp;
    for (int i = 0;i < s.size();i++)
    {
        if (s[i] != ' ') tmp += s[i];
        else
        {
            a[pos++] = tmp;
            tmp.clear();
        }
    }
    //处理最后一个单词
    a[pos] = tmp;
    reverse(a.begin(), a.end());
    for (int i = 0;i < a.size();i++)
    {
        if (a[i] == "") continue;
        cout << a[i] << " ";
    }
    return 0;
}